<div id="content" class="profile">
    <?if((!$data->settings->profile || $data->settings->profile->vcard || $data->settings->profile->profile) || EDITOR):?>
        <?if((MEMBER && ($data->settings->profile->profile || !$data->settings->profile)) || EDITOR):?>
        <div class="profileSide">
        <?if($data->profile->photo->check):?>
            <a href="/profile/photos/<?=$data->profile->ID?>">
                <img class="profileImage" src="http://<?=COOKIELESS.'/'.$data->profile->photo->profile?>" alt="<?=$data->profile->fullname?>"/>
            </a>
        <?else:?>
            <img class="profileImage <?=$data->profile->sex?>" src="http://<?=COOKIELESS.'/'.$data->profile->photo->profile?>" alt="<?=$data->profile->fullname?>"/>
        <?endif;?>
        <ul id="profileMenu">
        <?
        // PROFILE FUNCTIONS
        if(OWN):?>
        <li><a id="profile" href="/profile/edit"><?=_('Edit your profile')?></a>
        <?else:
            foreach ($data->APPS as $i)
                @include 'apps/'.$i.'/template/_profile_func.html';
          endif;
        ?>
        </ul>
        </div>
        <div class="profileMain">
            <h1><?=$data->TITLE?></h1>
            <div class="joindate"><?=common::date($data->profile->date)?></div>
            <?if($data->profile->status != 'offline'):?>
            <div class="status <?=$data->profile->status?>"><?=$data->profile->statusmsg?></div>
            <?else:?>
            <div class="lastlogin"><?=common::date($data->profile->lastlogin)?></div>
            <?endif;?>
            <h2><span><?=_('Basic Information')?></span></h2>
            <dl>
                <dt><?=_('Sex')?>:</dt>
                    <dd><?=$data->profile->gender?></dd>
                <dt><?=_('Age')?>:</dt>
                    <dd><?=$data->profile->age?></dd>
                <?if($data->profile->hometown->country->name):?>
                <dt><?=_('Hometown')?>:</dt>
                    <dd>
                        <a href="/search/profile?country=<?=$data->profile->hometown->country->code?>&region=<?=$data->profile->hometown->region->code?>">
                            <?=$data->profile->hometown->region->name?>
                        </a> /
                        <a href="/search/profile?country=<?=$data->profile->hometown->country->code?>">
                            <?=$data->profile->hometown->country->name?>
                        </a>
                    </dd>
                <?endif;?>
                <?if($data->profile->relationshipStatus):?>
                <dt><?=_('Relationship status')?>:</dt>
                    <dd><?=_($data->profile->relationshipStatus)?></dd>
                <?endif;?>
                <dt><?=_('Interested in')?>:</dt>
                    <dd><?=$data->profile->interestedIn->men?'<span>'._('Men').'</span>':''?>
                        <?=$data->profile->interestedIn->women?'<span>'._('Women').'</span>':''?></dd>
                <dt><?=_('Looking for')?>:</dt>
                    <dd><?=$data->profile->lookingFor->friendship?'<span>'._('Friendship').'</span>':''?>
                        <?=$data->profile->lookingFor->dating?'<span>'._('Dating').'</span>':''?>
                        <?=$data->profile->lookingFor->relationship?'<span>'._('Relationship').'</span>':''?>
                        <?=$data->profile->lookingFor->networking?'<span>'._('Networking').'</span>':''?></dd>
            </dl>
            <div class="clear"></div>
            <h2><span><?=_('Personal Information')?></span></h2>
            <dl>
                <dt><?=_('About us ')?>:</dt>
                <dd><?=nl2br($data->profile->about)?></dd>
            </dl>
            <div class="clear"></div>
            <?if($data->profile->highschool || $data->profile->university || $data->profile->occupation || $data->profile->companies):?>
            <h2><span><?=_('Education and Work')?></span></h2>
            <?if($data->profile->highschool):?>
            <dl>
                <dt><?=_('High School')?>:</dt>
                <dd><?=($data->profile->highschool)?></dd>
            </dl>
            <?endif;?>
            <?if($data->profile->university):?>
            <dl>
                <dt><?=_('University')?>:</dt>
                <dd><?=($data->profile->university)?></dd>
            </dl>
            <?endif;?>
            <?if($data->profile->occupation):?>
            <dl>
                <dt><?=_('Occupation')?>:</dt>
                <dd><?=($data->profile->occupation)?></dd>
            </dl>
            <?endif;?>
            <?if($data->profile->companies):?>
            <dl>
                <dt><?=_('Companies')?>:</dt>
                <dd><?=($data->profile->companies)?></dd>
            </dl>
            <?endif;?>
            <div class="clear"></div>
            <?endif;?>

            <?if($data->profile->contact->country->name):?>
            <h2><span><?=_('Contact Information')?></span></h2>
            <dl>
                <dt><?=_('Location')?>:</dt>
                    <dd>
                        <a href="/search/profile?country=<?=$data->profile->contact->country->code?>&region=<?=$data->profile->contact->region->code?>">
                            <?=$data->profile->contact->region->name?>
                        </a> /
                        <a href="/search/profile?country=<?=$data->profile->contact->country->code?>">
                            <?=$data->profile->contact->country->name?>
                        </a>
                    </dd>
            </dl>
            <?endif?>
            <div class="clear"></div>
            <?
            // PROFILE BELLY
            foreach ($data->APPS as $i)
                @include 'apps/'.$i.'/template/_profile_content.html';
            ?>
            <div class="clear"></div>
        </div>
        <?else:?>
        <div class="vcard">
            <img class="photo" src="http://<?=COOKIELESS.'/'.$data->profile->photo->profile?>" alt="<?=$data->profile->fullname?>"/>
            <div class="fn"><?=$data->profile->fullname?></div>
            <span class="nickname"><?=$data->profile->username?></span>
            <span class="url">http://<?=DOMAIN.$data->profile->url?></span>
            <span class="adr">
                <span class="country-name"><?=$data->profile->contact->country->name?></span>
                <span class="region"><?=$data->profile->contact->region->name?></span>
            </span>
            <span class="title"><?=$data->profile->job?></span>
        </div>
        <div class="joindate"><?=common::date($data->profile->date)?></div>
        <div class="lastlogin"><?=common::date($data->profile->lastlogin)?></div>
        <?endif?>
    <?else:?>
    <h1><?=$data->TITLE?></h1>
    <h2 class="desc"><?=$data->DESCRIPTION?></h2>
    <?endif?>
    <div class="clear"></div>
</div>
<div id="aside">
    <?
    // PROFILE ASIDE
    foreach ($data->APPS as $i)
        @include 'apps/'.$i.'/template/_profile_aside.html';
    ?>
</div>